package com.handlemvc.mhc.controller;

import com.handlemvc.mhc.model.UserModel;
import com.handlemvc.mhc.service.UserService;
import com.handlemvc.springmvc.annotation.Autowired;
import com.handlemvc.springmvc.annotation.Controller;
import com.handlemvc.springmvc.annotation.RequestMapping;
import com.handlemvc.springmvc.annotation.ResponseBody;

import java.util.List;

/**
 * @author ：tiger.
 * @date ：2021/10/12 23:49
 */
@Controller("userController")
public class UserController {

	@Autowired(value = "userService")
	private UserService userService;

	@RequestMapping("/findUser")
	public String findUser(String username){
		userService.findUser(username);
		return "forward:/success.jsp";
	}

	@RequestMapping("/getUsers")
	@ResponseBody
	public List<UserModel> getUsers(){
		return userService.getUsers();
	}
}
